//
//  OutPrescListViewModel.m
//  HonlivApp
//
//  Created by admin on 2017/6/26.
//  Copyright © 2017年 honliv. All rights reserved.
//

#import "OutPrescListViewModel.h"
#import "OuptPrescListModel.h"

static NSString *const prescList_url = @"api/Account/GetOuptPrescList";

@implementation OutPrescListViewModel

-(void)getPrescListWithDic:(NSDictionary *)dic success:(void (^)(NSArray *array))completion{
    NSString *url = [NSString stringWithFormat:@"%@%@",HOSPITAL_URL,prescList_url];
    [NetWorker getCommonDatasWithURLStr:url body:dic success:^(id result) {
        NSArray *resultArr = [JsonHelper arrayWithJsonString:result[@"Entity"]];
        NSMutableArray *modelArr = [NSMutableArray array];
        for (NSDictionary *dic in resultArr) {
            OuptPrescListModel *model = [OuptPrescListModel setPrescListModel:dic];
            [modelArr addObject:model];
        }
        _datasArray = [NSArray arrayWithArray:modelArr];
        completion(modelArr);
        
    } failure:^(id result) {
        completion([NSArray array]);
    }];

}

@end
